<div class="left">
    <?php if ($model) { ?>
        <div class="list-upload">
    	<div class="box-li box-content">
    	    <div class="left-li">
    		<img src="<?php echo $model->user->getAvatarUrl() ?>" />
    		<p><a href="<?php echo SITE_NAME_URL ?>user/<?php echo $model->user_id ?>"><?php echo h($model->user->username, 9); ?></a></p>
    	    </div>
    	    <div class="right-li">
    		<div class="mui"></div>
    		<ul class="menu-icon">
    		    <li><img src="<?php echo WWW_URL ?>images/date.jpg" /> Date: <?php echo date('m-d-Y', strtotime($model->time_created)); ?></li>
    		    <li><img src="<?php echo WWW_URL ?>images/comment.jpg" /> <a id="total-comment-<?php echo $model->post_id ?>"><?php echo $model->total_comment ?></a></li>
    		    <li title="Copy Url of this post">
    			<span class="contain-url">Url: </span><span class="contain-url" id="url<?php echo $model->post_id ?>"><?php echo SITE_NAME_URL ?>post/<?php echo $model->post_id ?></span>
    			<a title="Copy Url of this post" id="copy-link-<?php echo $model->post_id ?>" href="javascript:void(0)"><i><img src="<?php echo WWW_URL ?>img/copy-icon.png"/></i> Copy URL</a>
    		    </li>

    		    <li><?php $this->widget('application.widgets.reportabuse.ReportAbuse', array('model' => $model)); ?></li>

    		</ul>
    		<h4><a><?php echo h($model->title, 0, FilterWord::getListFilter()); ?></a></h4>
    		<div class="text-li">
			<?php
			if ($model->attachment) {
			    $attachment = unserialize($model->attachment);
			    $i = 0;
			    if (isset($attachment['photo']) && $attachment['photo']) {
				foreach ($attachment['photo'] as $photo) {
				    echo '<a rel="example_group" class="show-enlarge-img" href="#popup-img-' . $i . '"><img src="' . UPLOAD_URL . 'photo/' . $photo . '"/></a>';
				    echo '<br>';
				    echo '<br>';
				    ?>

				    <div style="display:none">
					<div id="popup-img-<?php echo $i ?>">
					    <img src="<?php echo UPLOAD_URL . 'photo/' . $photo ?>" />
					</div>
				    </div>
				    <?php
				    $i++;
				}
			    }

			    if (isset($attachment['audio']) && $attachment['audio']) {
				?>
	    		    <audio width="500" controls>
	    			<source src="<?php echo UPLOAD_URL . 'audio/' . $attachment['audio'] ?>" type="audio/ogg">
	    			<source src="<?php echo UPLOAD_URL . 'audio/' . $attachment['audio'] ?>" type="audio/mpeg">
	    			Your browser does not support the audio element.
	    		    </audio>
				<?php
				echo '<br>';
			    }

			    if (isset($attachment['video']['upload']) && $attachment['video']['upload']) {
				?>

	    		    <video width="500" height="400" controls="controls" preload="none">		

	    			<source type="application/x-mpegURL" src="<?php echo UPLOAD_URL . 'video/' . $attachment['video']['upload'] ?>"/>			
	    			<!-- MP4 for Safari, IE9, iPhone, iPad, Android, and Windows Phone 7 -->
	    			<source type="video/mp4" src="<?php echo UPLOAD_URL . 'video/' . $attachment['video']['upload'] ?>" />
	    			<!-- WebM/VP8 for Firefox4, Opera, and Chrome -->
	    			<source type="video/webm" src="<?php echo UPLOAD_URL . 'video/' . $attachment['video']['upload'] ?>" />
	    			<!-- Ogg/Vorbis for older Firefox and Opera versions -->
	    			<source type="video/ogg" src="<?php echo UPLOAD_URL . 'video/' . $attachment['video']['upload'] ?>" />
				    <?php /*
				      <!-- Optional: Add subtitles for each language -->
				      <track kind="subtitles" src="subtitles.srt" srclang="en" />
				      <!-- Optional: Add chapters -->
				      <track kind="chapters" src="chapters.srt" srclang="en" />
				     * 
				     */ ?>
	    			<!-- Flash fallback for non-HTML5 browsers without JavaScript -->
	    			<object width="320" height="240" type="application/x-shockwave-flash" data="<?php echo WWW_URL; ?>js/mediaelement/flashmediaelement.swf">
	    			    <param name="movie" value="<?php echo WWW_URL; ?>js/mediaelement/flashmediaelement.swf" />
	    			    <param name="flashvars" value="controls=true&file=<?php echo UPLOAD_URL . 'video/' . $attachment['video']['upload'] ?>" />
	    			    <!-- Image as a last resort -->
	    			    <img src="" width="320" height="240" title="No video playback capabilities" />
	    			</object>
	    		    </video>
				<?php
				echo '<br>';
			    }
			}
			?>
    		    <br><br>
			<?php
			echo nl2br(h($model->content, 0, FilterWord::getListFilter()));
			?>
    		</div>


    	    </div>
    	</div><!--box-li-->

        </div><!--ist-upload-->

	<?php if (!user()->isGuest && user()->getModel()->status == User::STATUS_ACTIVE) { ?>
	    <div class="comment">
		<img src="<?php echo user()->getModel()->getAvatarUrl() ?>"/>
		<a href="javascript:void(0)" class="btn btn-post-comment">Submit</a>
		<textarea placeholder="Comment" class="comment-txt" post_id='<?php echo $model->post_id ?>'></textarea>
	    </div>

	<?php } ?>

	<?php
	if ($totalComment > 0) {

	    foreach ($modelComment as $comment) {
		?>
	        <div class="box-li">
	    	<div class="left-li">
	    	    <img src="<?php echo $comment->user->getAvatarUrl() ?>" />
	    	    <p><a href="<?php echo SITE_NAME_URL ?>user/<?php echo $comment->user_id ?>"><?php echo h($comment->user->username, 9); ?></a></p>
	    	</div>
	    	<div class="right-li">
	    	    <div class="mui"></div>
	    	    <div class="date-com">
	    		<table>
	    		    <tr>
	    			<td><?php echo date('m-d-Y', strtotime($comment->time_created)); ?></td>
	    			<td><?php $this->widget('application.widgets.reportabuse.ReportAbuse', array('model' => $comment)); ?></td>
	    		    </tr>
	    		</table>

	    	    </div>
	    	    <div class="text-li">
			    <?php echo nl2br(h($comment->content, 0, FilterWord::getListFilter())); ?>
	    	    </div>

	    	</div>
	        </div><!--box-li-->
		<?php
	    }

	    if ($totalComment > Comment::TOTAL_RECORD) {
		?>

	        <a href="javascript:void(0)" class="btn btn-info view-more-comment" nextPage="2" idPost="<?php echo $model->post_id; ?>">View more</a>
		<?php
	    }
	}


	/**
	 * copy link to clip board
	 */
	?>

        <script>

    	$(document).ready(function() {

    	    $('a#copy-link-<?php echo $model->post_id ?>').zclip({
    		path: 'http://davidwalsh.name/demo/ZeroClipboard.swf',
    		copy: $('#url<?php echo $model->post_id ?>').text()
    	    });
    	});
        </script>
	<?php
    }
    ?>
</div><!--left-->
<div class="right">  
    <div class="box-right">
	<?php $this->widget('application.widgets.loginbox.LoginBox'); ?>

    </div><!--box-right-->
    <?php $this->widget('application.widgets.ad.Ad'); ?>
</div><!--right-->
